package personal.xjl._23java2studentdemo.spring;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component("myAnotherAdvice")
@Aspect
public class MyAnotherAdvice {
    @Before("execution(* personal.xjl._23java2studentdemo.spring.MyMath.add())")
    public void before(){
    System.out.println("另一前置增强");
    }
    @AfterReturning("execution(* personal.xjl._23java2studentdemo.spring.MyMath.sub())")
    public void after(){
        System.out.println("另一后置增强");
    }
    @Around("execution(* personal.xjl._23java2studentdemo.spring.MyMath.mul())")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("环绕增强开始");
        Object result = pjp.proceed();
        System.out.println("结束");
        return result;
    }
}
